/**
 * 作者: wgx
 * 日期: 2024-12-13 17:40:52
 * 备注: 用户装饰类道具表,头像,头像框,称号等
 */
package com.motu.monstercity.server.game.userdata;

import com.motu.monstercity.server.game.commondata.bag.ItemId;
import com.motu.monstercity.server.game.log.MotuLogManager;

public class UserDecorate extends UserDecorateModel {
    public UserDecorate() {
        super();
    }

    // 记录日志并增加称号数量
    public void addNum(UserInfo userInfo, int addNum, Object... params) {
        int balance = (int) getNum();// 当前余额
        long dbid = 0;
        MotuLogManager.logItemIncome(userInfo, getDecorateId(), dbid, balance, addNum, params);
        super.addNum(addNum);
    }

    // 扣除称号数量
    public void subNum(UserInfo userInfo, int subNum, Object... params) {
        int balance = (int) getNum();// 当前余额
        if (subNum > balance) {
            subNum = balance;// 全部扣除
        }
        long dbid = 0;
        MotuLogManager.logItemConsume(userInfo, getDecorateId(), dbid, balance, subNum, params);
        super.addNum(-subNum);
    }
}
